<script setup>
import { onMounted, ref, watch, reactive } from 'vue'
import {UserService} from '../http/api'
import { useRouter } from 'vue-router'
// import ChatIndex from './chat/ChatIndex.vue'
// defineProps({
//   msg: {
//     type: String,
//     required: true
//   }
// })
const router = useRouter()
onMounted(()=> {
    login4()
})
let arr = ref([])
const login4 = async () => {
  const loginParams = {
    page: 1,
    per_page: 3
  }
  const res = await UserService.login4(loginParams)
  console.log(res)
  arr.value = res.data
}

const active = ref(0);
watch(active, async (newQuestion, oldQuestion) => {
  console.log(newQuestion, oldQuestion)
  if(newQuestion === 0 ) {
    // router.push('home/chat')
    router.push({name: 'chat'})
  }
  if(newQuestion === 1 ) {
    // router.push('home/chat')
    router.push({name: 'blogs'})
  }
  if(newQuestion === 2 ) {
    // router.push('home/chat')
    router.push({name: 'mine'})
  }
  if(newQuestion === 3 ) {
    // router.push('home/chat')
    router.push({name: 'mine'})
  }
})
</script>

<template>
    <router-view />
   <van-tabbar v-model="active">
    <van-tabbar-item icon="home-o">标签</van-tabbar-item>
    <van-tabbar-item icon="search" dot>标签</van-tabbar-item>
    <van-tabbar-item icon="friends-o" badge="5">标签</van-tabbar-item>
    <van-tabbar-item icon="setting-o" badge="20">标签</van-tabbar-item>
  </van-tabbar>
</template>

<style scoped>

</style>
